<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp" %>

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp" %>
    <link href="${ctx}/lib/plugins/zTree_v3/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
    <style type="text/css">
    </style>
</head>
<body class="skin-blue sidebar-mini fixed skin-blue-light-frame" style="background-color:#fff">
<%-- style="margin-top:10px;min-height:230px;background:url('${ctx}/lib/img/zxUseraccont.png') no-repeat 60px 00px;}" --%>
    <section class="content" style="min-height: 138px;padding-bottom: 0px;">
        <div>
                <div class="box-body" style="height: 140px;" >
                	<div class="form-group form-group-xs " >
                	  <label for="bussinessShow" class="col-sm-0 control-label"><spring:message code='message.lable.queDingWei' /> ${name}
                	  <c:if test="${userType == 4 }">
                	   <spring:message code='message.lable.shengChengYLJGYongHuMa' /></label>
                	  </c:if>
                	  <c:if test="${userType != 4 }">
                	   <spring:message code='message.lable.shengChengZhuYongHuMa' /></label>
                	  </c:if>
				    </div>
	                    <div class="form-group form-group-xs" style="white-space:nowrap;">
                     	 	<c:if test="${businessGist=='1'}">
		                        <label for="bussinessShow" class="col-sm-2 control-label"><spring:message code="message.lable.bussinessShow" />:</label>
			                           <select id="bussinessShow" name="bussinessShow" style="width:100px;" > 
											 <option value=""><spring:message code='message.select.option' /></option>
											 <option value="0"><spring:message code='message.select.feiYeWuZhangHao'/></option>
											 <option value="1"><spring:message code='message.select.yeWuZhangHao'/></option>
									   </select>					                            
			                    <!-- <div class="form-group form-group-xs" style=" height:12px;padding-left:160px;color:#dd4b39;">
		                    		<div id="msgdiv" class=''> </div>
		                    	</div>  -->   
                   	 		 </c:if> 
				        </div>
						<%-- <div class="form-group form-group-xs " style="margin-left:49px;margin-bottom: 0px;">
							<c:if test="${checkGenerateSubAccount==1}">
								<div class="col-sm-2 control-label">
								  <div class="checkbox">
							        <label>
							          <input type="checkbox"  id="generateSubAccount" name="generateSubAccount" value="1"><spring:message code="message.lable.generateSubAccount" />
							        </label>
							      </div>
								</div>
							</c:if> 
						</div> --%>
				    <br/>
                     <!--   <div class="form-group form-group-xs">
					        <label for="newpassword" class="col-sm-2 text-right"><i class="fa fa-exclamation-circle fa-lg" style="color:#dd4b39;"></i>&nbsp;<span style="color:#dd4b39;font-weight:600">提示：</span></label>					        
						    <div class="col-sm-10 text-left" style="color:#dd4b39">提示说明信息 </div>
				             </div>--> 
                </div>
                 <div class="userInfo"></div>
        </div>
    </section>
    <div class="modal-footer" style="padding-top: 5px;padding-bottom: 5px;">
             <button type="button" class="btn btn-success btn-sm" onclick="ok();"><spring:message code='message.button.submit'/></button>
             <button type="button" class="btn btn-danger btn-sm"  onclick="closeDialog();"><spring:message code="message.button.close" /></button>
     </div>
    <%@ include file="/WEB-INF/component/commonJS.jsp" %>
        <script type="text" id="test">
<center>
		    登录网址：<br/><span class="url"></span><br/>
		<c:if test="${userType == 4 }"> 
            <div>{{each rows as row i}}
				{{row.name}}：{{row.userName}} 密码：{{row.password}}<br/>
		    {{/each}}
          </div>
        </c:if>
        <c:if test="${userType != 4 }"> 
          <div>主用户：<span class="zhu"></span> 密码：<span class="psr"></span><br/></div>
    	  <div>{{each rows as row i}}
				{{row.name}}：{{row.userName}} 密码：{{row.password}}<br/>
		  {{/each}}
           </div>
        </c:if>
</center>
    </script>
    <script type="text/javascript">
    var data = {
    		id:	"${id}",
    		userType:"${userType}",
    		bussinessShow:"",//账号类型
    		generateSubAccount:"0"//是否生成子账号
    }
    function print(){
    	$('.userInfo').jqprint();
    }
    function ok(){
    	if(!vil()){
    		return;
    	}
   	    $.HN.message.confirm("<spring:message code='message.HN.alert.queDingTiJiaoMa'/>", '', '').on(function (e) {
             if (e) {
            	   data.generateSubAccount=$("input[type=checkbox]:checked").val();
              	   $.post("${ctx}/sysUser/generateSubAccount.html",data, function(result) {
        			if (result.success) {
        				  $(".box-body").hide();
        				  $(".content").css("background","");
        				  var html = template('test', result);
                          $('.userInfo').html(html);
                          $(".zhu").html(result.conditions.zhuUserName);
                          $(".psr").html(result.conditions.zhuPassword);
                          $(".url").html(result.conditions.url);
                          var temp= $(".btn-success");
                          temp.attr("onclick","print();");
                          temp.html("<spring:message code='message.button.print'/>");
                          $('.btn-danger').attr("onclick","afferCloseDialog();");
                          $(".userInfo").show();
        				  top.$.HN.message.alert("<spring:message code='message.HN.alert.success'/>！", "", "success");
        			} else {
        				  top.$.HN.message.alert("<spring:message code='message.HN.alert.fail'/>！", "", "error");
        			}
        		}, "json");
   			 }
      	});
    }
	function vil(){
		if($("#bussinessShow").length>0){
			if($("#bussinessShow").val().length==0){
				$.HN.message.alert("<spring:message code='message.select.option'/><spring:message code='message.lable.bussinessShow'/>！", "", "warn");
				return false;
			}
			data.bussinessShow=$("#bussinessShow").val();
		}
		return true;
	}
	   function closeDialog() {
           var dialog = top.dialog.get(window);
           dialog.remove(); // 主动销毁对话框
       }
	   function afferCloseDialog() {
           var dialog = top.dialog.get(window);
           dialog.close();
           dialog.remove(); // 主动销毁对话框
           
       }
	  
    </script>
</body>
</html>
